package Include;

import Common.TacOp;
import Common.TacOperandType;
import Include.Scope;

public class TACLine {
    public int line;
    public TacOp op;
    public Operand src1;
    public Operand src2;
    public Operand dst;
    public Scope scope;

    public TACLine() {
        line = 0;
        op = null;
        src1 = null;
        src2 = null;
        dst = null;
        scope = null;
    }

    public TACLine(int line, TacOp op, Operand src1, Operand src2, Operand dst, Scope scope) {
        this.line = line;
        this.op = op;
        this.src1 = src1;
        this.src2 = src2;
        this.dst = dst;
        this.scope = scope;
    }


    public String toString() {
        return String.format("{%d}:\t(%s,\t%s,\t%s,\t%s)\t", line, op.name, src1.value, src2.value, dst.value);
    }

    public int getLine() {
        return line;
    }

    public void setLine(int line) {
        this.line = line;
    }

    public TacOp getOp() {
        return op;
    }

    public void setOp(TacOp op) {
        this.op = op;
    }

    public Operand getSrc1() {
        return src1;
    }

    public void setSrc1(Operand src1) {
        this.src1 = src1;
    }

    public Operand getSrc2() {
        return src2;
    }

    public void setSrc2(Operand src2) {
        this.src2 = src2;
    }

    public Operand getDst() {
        return dst;
    }

    public void setDst(Operand dst) {
        this.dst = dst;
    }

    public Scope getScope() {
        return scope;
    }

    public void setScope(Scope scope) {
        this.scope = scope;
    }
}

// TODO TACBlock = List<TACLine>
// TODO TACFile = Dict[str, TACBlock] Map<String, List<TACLine>

